<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
require "../config.php";
require "../libs/db_functions.php";

  CONNECT_DB();
    mysql_query("SET NAMES utf8");

	$sql=" SELECT * FROM story_list";//  ORDER BY view DESC => most read
    $result=mysql_query($sql);
	$data=array();
	$ydimention=0;
	while($rows=mysql_fetch_array($result)){
      $data[$ydimention]=$rows;
	  $ydimention++;
    }

	/*
	foreach ($data as $dt){
		echo $dt;
	}
	*/
	//echo '<pre>'; 
	echo json_encode($data);
	//free resource
	CLOSE_DB();
	unset($sql, $result, $data, $ydimention);
	//print_r($data); //echo '</pre>';
          
?> 